// index.js
// 获取应用实例
// const app = getApp()

Page({
  data: {
    topBarHeigth: 0,
    bannerImgUrl: [],
    storeAnnouncement: '',
    navInfo: [],
    imgUrl: [],
    txt: '',
    likeGoodsInfo: [],
    show: true
  },

  onLoad() {
    const systemInfo = wx.getSystemInfoSync()
    // console.log(systemInfo)
    this.setData({
      topBarHeigth: systemInfo.statusBarHeight
    })

    this.getIndexInfo()
  },

  async getIndexInfo() {
    const {data} = await wx.http.get('/page/detail')
    // console.log(data)
    if (data.status !== 200) return wx.utils.toast('数据加载失败！')
    this.setData({
      bannerImgUrl: data.data.pageData.items[1].data,
      storeAnnouncement: data.data.pageData.items[2].params.text,
      navInfo: data.data.pageData.items[3].data,
      imgUrl: data.data.pageData.items[4].data,
      txt: data.data.pageData.items[5].params.content,
      likeGoodsInfo: data.data.pageData.items[6].data
    })
  }
})
